﻿@model Article
@inject  NetCoreCMS.IServices.IArticle_categoryService _article_category
@inject  NetCoreCMS.IServices.IArticle_goods_specService _article_goods_spec
@{
    Layout = null;
    Sysconfig config = ViewData["config"] as Sysconfig;
    List<Article> relList = ViewBag.relList as List<Article>;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>@Model.title</title>
    <meta name="keywords" content="@Model.seo_keywords" />
    <meta name="description" content="@Model.seo_description" />
    <link rel="stylesheet" type="text/css" href="/mobile/css/idangerous.swiper.css" />
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/idangerous.swiper-2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/common.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/cart.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var mySwiper = new Swiper('.swiper-container', {
                calculateHeight: true,
                resizeReInit: true,
                pagination: ".pagination",
                autoplay: 5000,
                paginationClickable: true
            });
            //初始化规格事件
            initGoodsSpec('/submit_ajax?action=get_article_goods_info&channel_id=@Model.channel_id');
        });
    </script>
</head>

<body ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>购物商城</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" onclick="showDialogBox('#category-box');">
                    <i class="iconfont icon-nav"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->
        <!--页面内容-->
        <div class="page__bd">
            <!--商品幻灯片-->
            <div id="slider" class="swiper-container">
                <div class="swiper-wrapper">
                    @if (Model.albums != null)
                    {
                        @foreach (Article_albums modelt in Model.albums)
                        {
                            <div class="swiper-slide">
                                <img src="@modelt.thumb_path" />
                            </div>
                        }
                    }
                </div>
                <div class="pagination"></div>
            </div>
            <!--/商品幻灯片-->
            <!--商品名称-->
            <div class="weui-panel weui-panel_access" style="margin-top:0;">
                <div class="weui-panel__bd">
                    <div class="goods-head">
                        <h2>@Model.title</h2>
                        <p><span class="price" id="commoditySellPrice">¥@Model.sell_price</span>元</p>
                    </div>
                </div>

            </div>
            <!--/商品名称-->
            <!--参数选择-->
            <div class="weui-panel weui-panel_access item-list">
                <div class="weui-panel__bd">
                    <a id="selectSpecText" class="weui-cell weui-cell_access" href="javascript:;" onclick="showActionSheet();">
                        <div class="weui-cell__bd">
                            <p>选择规格、数量</p>
                        </div>
                        <div class="weui-cell__ft"></div>
                    </a>
                    <a class="weui-cell weui-cell_access" href="#commentList">
                        <div class="weui-cell__bd">
                            <p>查看评论</p>
                        </div>
                        <div class="weui-cell__ft">
                            共
                            <script type="text/javascript" src="/view_ajax?action=view_comment_count&channel_id=@Model.channel_id&id=@Model.id"></script>条评论
                        </div>
                    </a>

                </div>

            </div>
            <!--/参数选择-->
            <!--商品参数-->
            <div class="weui-panel weui-panel_access item-list">
                <div class="weui-panel__hd">商品参数</div>
                <div class="weui-panel__bd">
                    <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                            <p>货号：<span id="commodityGoodsNo">@Model.goods_no</span></p>
                        </div>
                    </div>
                    <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                            <p>市场价：<s id="commodityMarketPrice">¥@Model.market_price</s></p>
                        </div>
                    </div>
                    <div class="weui-cell weui-cell_access">
                        <div class="weui-cell__bd">
                            <p>上架时间：@Model.add_time</p>
                        </div>
                    </div>

                </div>

            </div>
            <!--/商品参数-->
            <!--商品介绍-->
            <div class="weui-panel weui-panel_access">
                <div class="weui-panel__hd">商品介绍</div>
                <div class="weui-panel__bd">
                    <div class="entry">
                        @Html.Raw(Model.content)
                    </div>
                </div>
            </div>
            <!--/商品介绍-->
            <!--相关商品-->
            <div class="weui-panel weui-panel_access">
                <div class="weui-panel__hd">相关商品</div>
                <div class="weui-panel__bd">
                    <div class="img-list">
                        <ul>
                            @foreach (Article dr in relList)
                            {
                                <li>
                                    <div class="wrap">
                                        <a asp-route-id="@dr.id">
                                            <img src="@dr.img_url" />
                                            <div class="note">
                                                <h2>@dr.title</h2>
                                                <p>
                                                    <i class="hot">库存 @dr.stock_quantity</i>
                                                    <i class="price">¥@dr.sell_price</i>元
                                                </p>
                                            </div>
                                        </a>
                                    </div>
                                </li>
                            }
                            @if (relList.Count < 1)
                            {
                                <div class="nodata">暂无相关...</div>
                            }
                        </ul>
                    </div>

                </div>
            </div>
            <!--/相关商品-->
            <!--网友评论-->
            @if (Model.is_msg == 1)
            {
                @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Comment_box.cshtml")
            }
            <!--/网友评论-->
            <!--版权信息-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
            <!--/版权信息-->
            <!--底部按钮-->
            <div class="goods-btn-box">
                <div class="wrap-box">
                    <a class="red" href="javascript:;" onclick="showActionSheet('cart','','/Web/Cart');">
                        <i class="iconfont icon-cart"></i>
                        <span>加入购物车</span>
                    </a>
                    <a class="green" href="javascript:;" onclick="showActionSheet('buy','','/Web/Shopping');">
                        <i class="iconfont icon-order"></i>
                        <span>立即购买</span>
                    </a>
                </div>
            </div>
            <!--/底部按钮-->
            <!--规格容器-->
            <div>
                <div class="weui-mask" id="specMask" style="display:none"></div>
                <div class="weui-actionsheet spec-wrap" id="specActionsheet">
                    <div id="specActionsheetCancel" class="close">
                        <i class="iconfont icon-close"></i>
                    </div>
                    <div id="goodsSpecBox" class="spec-box">
                        @{var specList = _article_goods_spec.GetList(Model.id, "parent_id=0"); }
                            @if (specList != null)
                            {
                            @foreach (Article_goods_spec modelt1 in specList)
                            {
                            <dl>
                                <dt>@modelt1.title</dt>
                                <dd>
                                    <!--规格选项-->
                                    @{ var itemList = _article_goods_spec.GetList(Model.id, "parent_id=" + modelt1.spec_id);}
                                        @if (itemList != null)
                                        {
                                    @foreach (Article_goods_spec modelt2 in itemList)
                                    {
                                        <a specid="@modelt2.spec_id" title="@modelt2.title" href="javascript:;">
                                            <span>@modelt2.title</span>
                                        </a>
                                    }
                                        }
                                        <!--/规格选项-->
                                </dd>
                            </dl>
                                        }
                                        }
                            <div class="btn-box">
                                <dt>购物数量<span>(库存<b id="commodityStockNum">@Model.stock_quantity</b>件)</span></dt>
                                <dd>
                                    <input id="commodityChannelId" type="hidden" value="@Model.channel_id" />
                                    <input id="commodityArticleId" type="hidden" value="@Model.id" />
                                    <input id="commodityGoodsId" type="hidden" value="0" />
                                    <input id="commodityShopId" type="hidden" value="@Model.shop_id" />
                                    <a class="reduce" href="javascript:;" onclick="addCartNum(-1);">-</a>
                                    <input id="commoditySelectNum" class="input" type="text" value="1" maxValue="@Model.stock_quantity" onkeydown="return checkNumber(event);" />
                                    <a class="subjoin" href="javascript:;" onclick="addCartNum(1);">+</a>
                                </dd>
                            </div>
                    </div>

                    <div class="weui-actionsheet__action">
                        <button id="confirmButton" class="weui-actionsheet__cell over" disabled="disabled">确定</button>
                    </div>
                </div>
            </div>
            <!--规格容器-->
        </div>
        <!--/页面内容-->
    </div>

    <!--类别容器-->
    <div id="category-box" class="dialog-wrap">
        <div class="dialog-box">
            <div class="header">
                <a class="back" href="javascript:;" onclick="closeDialogBox('#category-box');">
                    <i class="iconfont icon-arrow-left"></i>
                </a>
                <h3>栏目类别</h3>
            </div>
            <ul class="navbar">
                @{
                    var categoryList1=_article_category.GetChildList(0,0,2);
                }
                @foreach(Article_category cdr1 in categoryList1)
                {
                <li>
                    <h3><a asp-action="List" asp-route-id="@cdr1.id">@cdr1.title</a></h3>
                    <p>
                        @{
                           var categoryList2 = _article_category.GetChildList(0, cdr1.id, 2);
                        }
                        @foreach(Article_category cdr2 in categoryList2)
                        {
                        if(cdr2.id==@Model.category_id)
                        {
                        <a asp-action="List" asp-route-id="@cdr2.id" class="selected">@cdr2.title</a>
                        }
                        else
                        {
                    <a asp-action="List" asp-route-id="@cdr2.id">@cdr2.title</a>
                        }
                        }
                    </p>
                </li>
                }
            </ul>
        </div>
    </div>
    <!--类别容器-->

</body>
</html>
